
class Ball:
    def bounce(self):
        if self.direction == "down":
            self.direction = "up" 
        else self.direction = "up":
            self.direction = "down"  #改变球的方向  
ball = Ball()  #建立类的一个实例
ball.color = input("Please enter your ball's color:")
ball.size = input("Please enter your ball's size:")
ball.direction = input("Please enter your ball's direction:")
print("The ball's color is",ball.color,"The ball's size is",ball.size,"The ball's direction is",ball.direction)
print("Now I'm going to bonuce the ball.")
print
ball.bounce()   
print(ball.direction)
print("The ball will go",ball.direction)
#初始化对象：在创建对象时就设置对象的属性，表示在开始时做好准备initializing
#创建类定义时，_init_()方法传递参数在创建实例时设置对象的属性


